<layout name ="common" />
<div class="templatemo-content-widget no-padding">
	<div class="panel panel-default table-responsive">
		<table class="table table-striped table-bordered templatemo-user-table">
			<thead>
				<div class="panel-heading border-radius-10">
					<h2 style="font-size: 20px; display: inline-block; padding-left: 100px;">评论列表</h2>
				</div>
				<tr>
					<th style="text-align: center;"><a href="__ROOT__/comment/listComment/order/id" class="white-text templatemo-sort-by">ID <span class="caret"></span></a></th>
					<th style="text-align: center;"><a href="__ROOT__/comment/listComment/order/name" class="white-text templatemo-sort-by">评论者 <span class="caret"></span></a></th>
					<th style="text-align: center;"><a href="__ROOT__/comment/listComment/order/email" class="white-text templatemo-sort-by">EMAIL <span class="caret"></span></a></th>
					<th style="text-align: center;"><a href="__ROOT__/comment/listComment/order/toname" class="white-text templatemo-sort-by">回复 <span class="caret"></span></a></th>
					<th style="text-align: center;"><a href="__ROOT__/comment/listComment/order/toart" class="white-text templatemo-sort-by">文章 <span class="caret"></span></a></th>
					<th style="text-align: center;"><a href="__ROOT__/comment/listComment/order/comment" class="white-text templatemo-sort-by">内容 <span class="caret"></span></a></th>
					<th style="text-align: center;"><a href="__ROOT__/comment/listComment/order/time desc" class="white-text templatemo-sort-by">时间 <span class="caret"></span></a></th>
					<th style="text-align: center;">操作</th>
				</tr>
			</thead>
			<tbody style="text-align: center;">
			<foreach name='res' item='k'>
				<tr>
					<td>{$k.id}</td>
					<td>{$k.name}</td>
					<td>{$k.email}</td>
					<td>
					<if condition='$k.toname eq null'>
					评论
					<else/>
					{$k.toname}
					</if>
					</td>
					<td>{$k.title}</td>
					<td>{$k.comment}</td>
					<td>{$k.time|date='Y-m-d H:i:s',###}</td>
					<if condition='$admininfo.is_admin eq 1'>
					<td>
						<a href="javascript:void(0)" onclick="change('{$k.name}','{$k.email}')" class="templatemo-is-btn">回复邮件</a>
						<a href="javascript:void(0)" onclick="delAdmin({$k.id})" class="templatemo-is-btn">删除</a>
					</td>
					<else />
					<td>当前用户无法操作</td>
					</if>
				</tr>
			</foreach>
			</tbody>
		</table>
	</div>
</div>
<div id="sendEmail" style="display: none; text-align: center;">
	<div style="margin: 100px auto; width: 600px; height: 450px;background-color:#FFF;border: 2px solid #000;"  class="templatemo-content-widget white-bg col-1 text-center templatemo-position-relative">
		<a href="javascript:void(0)" id="hide"><i class="fa fa-times"></i></a>
		<h2 class="text-uppercase blue-text margin-bottom-5"></h2>
		<form action="__ROOT__/msg/email" method="post">
			<hr>
			<h3 class="text-uppercase blue-text margin-bottom-5">TO:</h3>
			<input type="email" name="email" value="">
			<hr>
			<h3 class="text-uppercase blue-text margin-bottom-5">CONTENT:</h3>
			<textarea cols="60" rows="6" name="content"></textarea>
			<hr>
			<button id="btn" class="templatemo-blue-button">回复邮件</button>
		</form>
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$("#leftMenu a[class='active']").removeClass("active");
		$('#leftMenu a:eq(4)').addClass("active");
	});
	function delAdmin(id){
		if(window.confirm("您确定要删除吗？")){
			window.location="__ROOT__/comment/delComment/id/"+id;
		}
	}
	function change(name,email) {
		document.getElementById('sendEmail').style.cssText='position: fixed; z-index:10; top:0px; left:0px; width: 100%; height: 100%; display: block; background-color: rgba(255,255,255,0.5);';
		$('#sendEmail h2').text('回复：'+name);
		$('#sendEmail input').val(email);
		$('#hide').show();
	}
	$('#hide').click(function () {
		$('#sendEmail').hide();
	})
</script>